package com.jimmy.aop;

import com.jimmy.aop.config.ConfigOfAop;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @version 1.0
 * @ ClassName AopApp
 * <p> TODO
 * @ author JIMMY
 * @ Date 2020/10/31 0031 下午 10:14
 */
public class AopApp {

    @Test
    public   void test1() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao = (UserDao) ctx.getBean("userDao");
        userDao.save();
        userDao.saveArgs(1,"jimmy");
        userDao.saveReturn(2,"jimmy2");
    }
    @Test
    public   void test2() {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ConfigOfAop.class);
        UserDao userDao = (UserDao) ctx.getBean("userDao");
        userDao.save();
        userDao.saveArgs(1,"jimmy");
        userDao.saveReturn(2,"jimmy2");
    }
}
